package com.mxprojects.gui
{
	import flash.display.Sprite;

	public class UserLevelIcon extends Sprite
	{
		private const ICON_RADIUS:Number = 3;
		
		private var icon:Sprite;
		
		public function UserLevelIcon(){
			icon = new Sprite();
			addChild(icon);
			
			//create a base icon
			createIcon(Styles.colorToUint(".iconUser"));
		}
		
		/**
		 * Set this to true if the user is a moderator.
		 * Pulls from the CSS style ".iconModerator"
		 * @param value
		 * 
		 */		
		public function set isModerator(value:Boolean):void {
			createIcon(Styles.colorToUint(".iconModerator"));
		}
		
		/**
		 * Set this to true if the user is an admin.
		 * Pulls from the CSS style ".iconAdmin" 
		 * @param value
		 * 
		 */		
		public function set isAdmin(value:Boolean):void {
			createIcon(Styles.colorToUint(".iconAdmin"));
		}
		
		private function createIcon(colour:uint):void {
			icon.graphics.beginFill(colour);
			icon.graphics.drawCircle(3,3,ICON_RADIUS);
			icon.graphics.endFill();
		}
	}
}